home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / LINUX / UFS_FS.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  21KB  |  571 lines

  1. /*
  2.  *  linux/include/linux/ufs_fs.h
  3.  *
  4.  * Copyright (C) 1996
  5.  * Adrian Rodriguez (adrian@franklins-tower.rutgers.edu)
  6.  * Laboratory for Computer Science Research Computing Facility
  7.  * Rutgers, The State University of New Jersey
  8.  *
  9.  * Clean swab support by Fare <fare@tunes.org>
  10.  * just hope no one is using NNUUXXI on __?64 structure elements
  11.  * 64-bit clean thanks to Maciej W. Rozycki <macro@ds2.pg.gda.pl>
  12.  *
  13.  * 4.4BSD (FreeBSD) support added on February 1st 1998 by
  14.  * Niels Kristian Bech Jensen <nkbj@image.dk> partially based
  15.  * on code by Martin von Loewis <martin@mira.isdn.cs.tu-berlin.de>.
  16.  *
  17.  * NeXTstep support added on February 5th 1998 by
  18.  * Niels Kristian Bech Jensen <nkbj@image.dk>.
  19.  *
  20.  * Write support by Daniel Pirkl <daniel.pirkl@email.cz>
  21.  */
  22.  
  23. #ifndef __LINUX_UFS_FS_H
  24. #define __LINUX_UFS_FS_H
  25.  
  26. #include <linux/types.h>
  27. #include <linux/kernel.h>
  28. #include <linux/time.h>
  29. #include <linux/stat.h>
  30.  
  31. #define UFS_BBLOCK 0
  32. #define UFS_BBSIZE 8192
  33. #define UFS_SBLOCK 8192
  34. #define UFS_SBSIZE 8192
  35.  
  36. #define UFS_SECTOR_SIZE 512
  37. #define UFS_SECTOR_BITS 9
  38. #define UFS_MAGIC 0x00011954
  39. #define UFS_CIGAM 0x54190100 /* byteswapped MAGIC */
  40.  
  41. #define UFS_BSIZE    8192
  42. #define UFS_MINBSIZE    4096
  43. #define UFS_FSIZE    1024
  44. #define UFS_MAXFRAG    (UFS_BSIZE / UFS_FSIZE)
  45.  
  46. #define UFS_NDADDR 12
  47. #define UFS_NINDIR 3
  48.  
  49. #define UFS_IND_BLOCK    (UFS_NDADDR + 0)
  50. #define UFS_DIND_BLOCK    (UFS_NDADDR + 1)
  51. #define UFS_TIND_BLOCK    (UFS_NDADDR + 2)
  52.  
  53. #define UFS_NDIR_FRAGMENT (UFS_NDADDR << uspi->s_fpbshift)
  54. #define UFS_IND_FRAGMENT (UFS_IND_BLOCK << uspi->s_fpbshift)
  55. #define UFS_DIND_FRAGMENT (UFS_DIND_BLOCK << uspi->s_fpbshift)
  56. #define UFS_TIND_FRAGMENT (UFS_TIND_BLOCK << uspi->s_fpbshift)
  57.  
  58. #define UFS_ROOTINO 2
  59. #define UFS_FIRST_INO (UFS_ROOTINO + 1)
  60.  
  61. #define UFS_USEEFT  ((__u16)65535)
  62.  
  63. #define UFS_FSOK      0x7c269d38
  64. #define UFS_FSACTIVE  ((char)0x00)
  65. #define UFS_FSCLEAN   ((char)0x01)
  66. #define UFS_FSSTABLE  ((char)0x02)
  67. #define UFS_FSOSF1    ((char)0x03)    /* is this correct for DEC OSF/1? */
  68. #define UFS_FSBAD     ((char)0xff)
  69.  
  70. /* From here to next blank line, s_flags for ufs_sb_info */
  71. /* endianness */
  72. #define UFS_BYTESEX             0x00000001      /* mask; leave room to 0xF */
  73. #if defined(__LITTLE_ENDIAN) || defined(__BIG_ENDIAN)
  74. /* these are for sane architectures */
  75. #define UFS_NATIVE_ENDIAN    0x00000000
  76. #define UFS_SWABBED_ENDIAN    0x00000001
  77. #else
  78. /* these are for pervert architectures */
  79. #define UFS_LITTLE_ENDIAN    0x00000000
  80. #define UFS_BIG_ENDIAN        0x00000001
  81. #endif
  82. /* directory entry encoding */
  83. #define UFS_DE_MASK        0x00000010    /* mask for the following */
  84. #define UFS_DE_OLD        0x00000000
  85. #define UFS_DE_44BSD        0x00000010
  86. /* uid encoding */
  87. #define UFS_UID_MASK        0x00000060    /* mask for the following */
  88. #define UFS_UID_OLD        0x00000000
  89. #define UFS_UID_44BSD        0x00000020
  90. #define UFS_UID_EFT        0x00000040
  91. /* superblock state encoding */
  92. #define UFS_ST_MASK        0x00000700    /* mask for the following */
  93. #define UFS_ST_OLD        0x00000000
  94. #define UFS_ST_44BSD        0x00000100
  95. #define UFS_ST_SUN        0x00000200
  96. #define UFS_ST_SUNx86        0x00000400
  97. /*cylinder group encoding */
  98. #define UFS_CG_MASK        0x00003000    /* mask for the following */
  99. #define UFS_CG_OLD        0x00000000
  100. #define UFS_CG_44BSD        0x00002000
  101. #define UFS_CG_SUN        0x00001000
  102.  
  103. /* fs_inodefmt options */
  104. #define UFS_42INODEFMT    -1
  105. #define UFS_44INODEFMT    2
  106.  
  107. /* mount options */
  108. #define UFS_MOUNT_ONERROR        0x0000000F
  109. #define UFS_MOUNT_ONERROR_PANIC        0x00000001
  110. #define UFS_MOUNT_ONERROR_LOCK        0x00000002
  111. #define UFS_MOUNT_ONERROR_UMOUNT    0x00000004
  112. #define UFS_MOUNT_ONERROR_REPAIR    0x00000008
  113.  
  114. #define UFS_MOUNT_UFSTYPE        0x000003F0
  115. #define UFS_MOUNT_UFSTYPE_OLD        0x00000010
  116. #define UFS_MOUNT_UFSTYPE_44BSD        0x00000020
  117. #define UFS_MOUNT_UFSTYPE_SUN        0x00000040
  118. #define UFS_MOUNT_UFSTYPE_NEXTSTEP    0x00000080
  119. #define UFS_MOUNT_UFSTYPE_OPENSTEP    0x00000100
  120. #define UFS_MOUNT_UFSTYPE_SUNx86    0x00000200
  121.  
  122. #define ufs_clear_opt(o,opt)    o &= ~UFS_MOUNT_##opt
  123. #define ufs_set_opt(o,opt)    o |= UFS_MOUNT_##opt
  124. #define ufs_test_opt(o,opt)    ((o) & UFS_MOUNT_##opt)
  125.  
  126. /*
  127.  * MINFREE gives the minimum acceptable percentage of file system
  128.  * blocks which may be free. If the freelist drops below this level
  129.  * only the superuser may continue to allocate blocks. This may
  130.  * be set to 0 if no reserve of free blocks is deemed necessary,
  131.  * however throughput drops by fifty percent if the file system
  132.  * is run at between 95% and 100% full; thus the minimum default
  133.  * value of fs_minfree is 5%. However, to get good clustering
  134.  * performance, 10% is a better choice. hence we use 10% as our
  135.  * default value. With 10% free space, fragmentation is not a
  136.  * problem, so we choose to optimize for time.
  137.  */
  138. #define UFS_MINFREE         5
  139. #define UFS_DEFAULTOPT      UFS_OPTTIME
  140.             
  141. /*
  142.  * Turn file system block numbers into disk block addresses.
  143.  * This maps file system blocks to device size blocks.
  144.  */
  145. #define ufs_fsbtodb(uspi, b)    ((b) << (uspi)->s_fsbtodb)
  146. #define    ufs_dbtofsb(uspi, b)    ((b) >> (uspi)->s_fsbtodb)
  147.  
  148. /*
  149.  * Cylinder group macros to locate things in cylinder groups.
  150.  * They calc file system addresses of cylinder group data structures.
  151.  */
  152. #define    ufs_cgbase(c)    (uspi->s_fpg * (c))
  153. #define ufs_cgstart(c)    (ufs_cgbase(c)  + uspi->s_cgoffset * ((c) & ~uspi->s_cgmask))
  154. #define    ufs_cgsblock(c)    (ufs_cgstart(c) + uspi->s_sblkno)    /* super blk */
  155. #define    ufs_cgcmin(c)    (ufs_cgstart(c) + uspi->s_cblkno)    /* cg block */
  156. #define    ufs_cgimin(c)    (ufs_cgstart(c) + uspi->s_iblkno)    /* inode blk */
  157. #define    ufs_cgdmin(c)    (ufs_cgstart(c) + uspi->s_dblkno)    /* 1st data */
  158.  
  159. /*
  160.  * Macros for handling inode numbers:
  161.  *     inode number to file system block offset.
  162.  *     inode number to cylinder group number.
  163.  *     inode number to file system block address.
  164.  */
  165. #define    ufs_inotocg(x)        ((x) / uspi->s_ipg)
  166. #define    ufs_inotocgoff(x)    ((x) % uspi->s_ipg)
  167. #define    ufs_inotofsba(x)    (ufs_cgimin(ufs_inotocg(x)) + ufs_inotocgoff(x) / uspi->s_inopf)
  168. #define    ufs_inotofsbo(x)    ((x) % uspi->s_inopf)
  169.  
  170. /*
  171.  * Give cylinder group number for a file system block.
  172.  * Give cylinder group block number for a file system block.
  173.  */
  174. #define    ufs_dtog(d)    ((d) / uspi->s_fpg)
  175. #define    ufs_dtogd(d)    ((d) % uspi->s_fpg)
  176.  
  177. /*
  178.  * Compute the cylinder and rotational position of a cyl block addr.
  179.  */
  180. #define ufs_cbtocylno(bno) \
  181.     ((bno) * uspi->s_nspf / uspi->s_spc)
  182. #define ufs_cbtorpos(bno) \
  183.     ((((bno) * uspi->s_nspf % uspi->s_spc / uspi->s_nsect \
  184.     * uspi->s_trackskew + (bno) * uspi->s_nspf % uspi->s_spc \
  185.     % uspi->s_nsect * uspi->s_interleave) % uspi->s_nsect \
  186.     * uspi->s_nrpos) / uspi->s_npsect)
  187.  
  188. /*
  189.  * The following macros optimize certain frequently calculated
  190.  * quantities by using shifts and masks in place of divisions
  191.  * modulos and multiplications.
  192.  */
  193. #define ufs_blkoff(loc)        ((loc) & uspi->s_qbmask)
  194. #define ufs_fragoff(loc)    ((loc) & uspi->s_qfmask)
  195. #define ufs_lblktosize(blk)    ((blk) << uspi->s_bshift)
  196. #define ufs_lblkno(loc)        ((loc) >> uspi->s_bshift)
  197. #define ufs_numfrags(loc)    ((loc) >> uspi->s_fshift)
  198. #define ufs_blkroundup(size)    (((size) + uspi->s_qbmask) & uspi->s_bmask)
  199. #define ufs_fragroundup(size)    (((size) + uspi->s_qfmask) & uspi->s_fmask)
  200. #define ufs_fragstoblks(frags)    ((frags) >> uspi->s_fpbshift)
  201. #define ufs_blkstofrags(blks)    ((blks) << uspi->s_fpbshift)
  202. #define ufs_fragnum(fsb)    ((fsb) & uspi->s_fpbmask)
  203. #define ufs_blknum(fsb)        ((fsb) & ~uspi->s_fpbmask)
  204.  
  205. #define    UFS_MAXNAMLEN 255
  206. #define UFS_MAXMNTLEN 512
  207. #define UFS_MAXCSBUFS 31
  208. #define UFS_LINK_MAX 32000
  209.  
  210. /*
  211.  * UFS_DIR_PAD defines the directory entries boundaries
  212.  * (must be a multiple of 4)
  213.  */
  214. #define UFS_DIR_PAD            4
  215. #define UFS_DIR_ROUND            (UFS_DIR_PAD - 1)
  216. #define UFS_DIR_REC_LEN(name_len)    (((name_len) + 1 + 8 + UFS_DIR_ROUND) & ~UFS_DIR_ROUND)
  217.  
  218. struct ufs_timeval {
  219.     __s32    tv_sec;
  220.     __s32    tv_usec;
  221. };
  222.  
  223. /*
  224.  * File types
  225.  */
  226. #define DT_UNKNOWN    0
  227. #define DT_FIFO        1
  228. #define DT_CHR        2
  229. #define DT_DIR        4
  230. #define DT_BLK        6
  231. #define DT_REG        8
  232. #define DT_LNK        10
  233. #define DT_SOCK        12
  234. #define DT_WHT        14
  235.    
  236. struct ufs_dir_entry {
  237.     __u32  d_ino;            /* inode number of this entry */
  238.     __u16  d_reclen;        /* length of this entry */
  239.     union {
  240.         __u16    d_namlen;        /* actual length of d_name */
  241.         struct {
  242.             __u8    d_type;        /* file type */
  243.             __u8    d_namlen;    /* length of string in d_name */
  244.         } d_44;
  245.     } d_u;
  246.     __u8    d_name[UFS_MAXNAMLEN + 1];    /* file name */
  247. };
  248.  
  249. struct ufs_csum {
  250.     __u32    cs_ndir;    /* number of directories */
  251.     __u32    cs_nbfree;    /* number of free blocks */
  252.     __u32    cs_nifree;    /* number of free inodes */
  253.     __u32    cs_nffree;    /* number of free frags */
  254. };
  255.  
  256. /*
  257.  * This is the actual superblock, as it is laid out on the disk.
  258.  */
  259. struct ufs_super_block {
  260.     __u32    fs_link;    /* UNUSED */
  261.     __u32    fs_rlink;    /* UNUSED */
  262.     __u32    fs_sblkno;    /* addr of super-block in filesys */
  263.     __u32    fs_cblkno;    /* offset of cyl-block in filesys */
  264.     __u32    fs_iblkno;    /* offset of inode-blocks in filesys */
  265.     __u32    fs_dblkno;    /* offset of first data after cg */
  266.     __u32    fs_cgoffset;    /* cylinder group offset in cylinder */
  267.     __u32    fs_cgmask;    /* used to calc mod fs_ntrak */
  268.     __u32    fs_time;    /* last time written -- time_t */
  269.     __u32    fs_size;    /* number of blocks in fs */
  270.     __u32    fs_dsize;    /* number of data blocks in fs */
  271.     __u32    fs_ncg;        /* number of cylinder groups */
  272.     __u32    fs_bsize;    /* size of basic blocks in fs */
  273.     __u32    fs_fsize;    /* size of frag blocks in fs */
  274.     __u32    fs_frag;    /* number of frags in a block in fs */
  275. /* these are configuration parameters */
  276.     __u32    fs_minfree;    /* minimum percentage of free blocks */
  277.     __u32    fs_rotdelay;    /* num of ms for optimal next block */
  278.     __u32    fs_rps;        /* disk revolutions per second */
  279. /* these fields can be computed from the others */
  280.     __u32    fs_bmask;    /* ``blkoff'' calc of blk offsets */
  281.     __u32    fs_fmask;    /* ``fragoff'' calc of frag offsets */
  282.     __u32    fs_bshift;    /* ``lblkno'' calc of logical blkno */
  283.     __u32    fs_fshift;    /* ``numfrags'' calc number of frags */
  284. /* these are configuration parameters */
  285.     __u32    fs_maxcontig;    /* max number of contiguous blks */
  286.     __u32    fs_maxbpg;    /* max number of blks per cyl group */
  287. /* these fields can be computed from the others */
  288.     __u32    fs_fragshift;    /* block to frag shift */
  289.     __u32    fs_fsbtodb;    /* fsbtodb and dbtofsb shift constant */
  290.     __u32    fs_sbsize;    /* actual size of super block */
  291.     __u32    fs_csmask;    /* csum block offset */
  292.     __u32    fs_csshift;    /* csum block number */
  293.     __u32    fs_nindir;    /* value of NINDIR */
  294.     __u32    fs_inopb;    /* value of INOPB */
  295.     __u32    fs_nspf;    /* value of NSPF */
  296. /* yet another configuration parameter */
  297.     __u32    fs_optim;    /* optimization preference, see below */
  298. /* these fields are derived from the hardware */
  299.     union {
  300.         struct {
  301.             __u32    fs_npsect;    /* # sectors/track including spares */
  302.         } fs_sun;
  303.         struct {
  304.             __s32    fs_state;    /* file system state time stamp */
  305.         } fs_sunx86;
  306.     } fs_u1;
  307.     __u32    fs_interleave;    /* hardware sector interleave */
  308.     __u32    fs_trackskew;    /* sector 0 skew, per track */
  309. /* a unique id for this filesystem (currently unused and unmaintained) */
  310. /* In 4.3 Tahoe this space is used by fs_headswitch and fs_trkseek */
  311. /* Neither of those fields is used in the Tahoe code right now but */
  312. /* there could be problems if they are.                            */
  313.     __u32    fs_id[2];    /* file system id */
  314. /* sizes determined by number of cylinder groups and their sizes */
  315.     __u32    fs_csaddr;    /* blk addr of cyl grp summary area */
  316.     __u32    fs_cssize;    /* size of cyl grp summary area */
  317.     __u32    fs_cgsize;    /* cylinder group size */
  318. /* these fields are derived from the hardware */
  319.     __u32    fs_ntrak;    /* tracks per cylinder */
  320.     __u32    fs_nsect;    /* sectors per track */
  321.     __u32    fs_spc;        /* sectors per cylinder */
  322. /* this comes from the disk driver partitioning */
  323.     __u32    fs_ncyl;    /* cylinders in file system */
  324. /* these fields can be computed from the others */
  325.     __u32    fs_cpg;        /* cylinders per group */
  326.     __u32    fs_ipg;        /* inodes per group */
  327.     __u32    fs_fpg;        /* blocks per group * fs_frag */
  328. /* this data must be re-computed after crashes */
  329.     struct ufs_csum fs_cstotal;    /* cylinder summary information */
  330. /* these fields are cleared at mount time */
  331.     __s8    fs_fmod;    /* super block modified flag */
  332.     __s8    fs_clean;    /* file system is clean flag */
  333.     __s8    fs_ronly;    /* mounted read-only flag */
  334.     __s8    fs_flags;    /* currently unused flag */
  335.     __s8    fs_fsmnt[UFS_MAXMNTLEN];    /* name mounted on */
  336. /* these fields retain the current block allocation info */
  337.     __u32    fs_cgrotor;    /* last cg searched */
  338.     __u32    fs_csp[UFS_MAXCSBUFS];    /* list of fs_cs info buffers */
  339.     __u32    fs_maxcluster;
  340.     __u32    fs_cpc;        /* cyl per cycle in postbl */
  341.     __u16    fs_opostbl[16][8];    /* old rotation block list head */    
  342.     union {
  343.         struct {
  344.             __s32    fs_sparecon[53];/* reserved for future constants */
  345.             __s32    fs_reclaim;
  346.             __s32    fs_sparecon2[1];
  347.             __s32    fs_state;    /* file system state time stamp */
  348.             __u32    fs_qbmask[2];    /* ~usb_bmask */
  349.             __u32    fs_qfmask[2];    /* ~usb_fmask */
  350.         } fs_sun;
  351.         struct {
  352.             __s32    fs_sparecon[53];/* reserved for future constants */
  353.             __s32    fs_reclaim;
  354.             __s32    fs_sparecon2[1];
  355.             __u32    fs_npsect;    /* # sectors/track including spares */
  356.             __u32    fs_qbmask[2];    /* ~usb_bmask */
  357.             __u32    fs_qfmask[2];    /* ~usb_fmask */
  358.         } fs_sunx86;
  359.         struct {
  360.             __s32    fs_sparecon[50];/* reserved for future constants */
  361.             __s32    fs_contigsumsize;/* size of cluster summary array */
  362.             __s32    fs_maxsymlinklen;/* max length of an internal symlink */
  363.             __s32    fs_inodefmt;    /* format of on-disk inodes */
  364.             __u32    fs_maxfilesize[2];    /* max representable file size */
  365.             __u32    fs_qbmask[2];    /* ~usb_bmask */
  366.             __u32    fs_qfmask[2];    /* ~usb_fmask */
  367.             __s32    fs_state;    /* file system state time stamp */
  368.         } fs_44;
  369.     } fs_u2;
  370.     __s32    fs_postblformat;    /* format of positional layout tables */
  371.     __s32    fs_nrpos;        /* number of rotational positions */
  372.     __s32    fs_postbloff;        /* (__s16) rotation block list head */
  373.     __s32    fs_rotbloff;        /* (__u8) blocks for each rotation */
  374.     __s32    fs_magic;        /* magic number */
  375.     __u8    fs_space[1];        /* list of blocks for each rotation */
  376. };
  377.  
  378. /*
  379.  * Preference for optimization.
  380.  */
  381. #define UFS_OPTTIME    0    /* minimize allocation time */
  382. #define UFS_OPTSPACE    1    /* minimize disk fragmentation */
  383.  
  384. /*
  385.  * Rotational layout table format types
  386.  */
  387. #define UFS_42POSTBLFMT        -1    /* 4.2BSD rotational table format */
  388. #define UFS_DYNAMICPOSTBLFMT    1    /* dynamic rotational table format */
  389.  
  390. /*
  391.  * Convert cylinder group to base address of its global summary info.
  392.  */
  393. #define fs_cs(indx) \
  394.     u.ufs_sb.s_csp[(indx) >> uspi->s_csshift][(indx) & ~uspi->s_csmask]
  395.  
  396. /*
  397.  * Cylinder group block for a file system.
  398.  *
  399.  * Writable fields in the cylinder group are protected by the associated
  400.  * super block lock fs->fs_lock.
  401.  */
  402. #define    CG_MAGIC    0x090255
  403. #define ufs_cg_chkmagic(ucg)    (SWAB32((ucg)->cg_magic) == CG_MAGIC)
  404.  
  405. /*
  406.  * size of this structure is 172 B
  407.  */
  408. struct    ufs_cylinder_group {
  409.     __u32    cg_link;        /* linked list of cyl groups */
  410.     __u32    cg_magic;        /* magic number */
  411.     __u32    cg_time;        /* time last written */
  412.     __u32    cg_cgx;            /* we are the cgx'th cylinder group */
  413.     __u16    cg_ncyl;        /* number of cyl's this cg */
  414.     __u16    cg_niblk;        /* number of inode blocks this cg */
  415.     __u32    cg_ndblk;        /* number of data blocks this cg */
  416.     struct    ufs_csum cg_cs;        /* cylinder summary information */
  417.     __u32    cg_rotor;        /* position of last used block */
  418.     __u32    cg_frotor;        /* position of last used frag */
  419.     __u32    cg_irotor;        /* position of last used inode */
  420.     __u32    cg_frsum[UFS_MAXFRAG];    /* counts of available frags */
  421.     __u32    cg_btotoff;        /* (__u32) block totals per cylinder */
  422.     __u32    cg_boff;        /* (short) free block positions */
  423.     __u32    cg_iusedoff;        /* (char) used inode map */
  424.     __u32    cg_freeoff;        /* (u_char) free block map */
  425.     __u32    cg_nextfreeoff;        /* (u_char) next available space */
  426.     union {
  427.         struct {
  428.             __u32    cg_clustersumoff;    /* (u_int32) counts of avail clusters */
  429.             __u32    cg_clusteroff;        /* (u_int8) free cluster map */
  430.             __u32    cg_nclusterblks;    /* number of clusters this cg */
  431.             __u32    cg_sparecon[13];    /* reserved for future use */
  432.         } cg_44;
  433.         __u32    cg_sparecon[16];    /* reserved for future use */
  434.     } cg_u;
  435.     __u8    cg_space[1];        /* space for cylinder group maps */
  436. /* actually longer */
  437. };
  438.  
  439. /*
  440.  * structure of an on-disk inode
  441.  */
  442. struct ufs_inode {
  443.     __u16    ui_mode;        /*  0x0 */
  444.     __u16    ui_nlink;        /*  0x2 */
  445.     union {
  446.         struct {
  447.             __u16    ui_suid;    /*  0x4 */
  448.             __u16    ui_sgid;    /*  0x6 */
  449.         } oldids;
  450.         __u32    ui_inumber;        /*  0x4 lsf: inode number */
  451.         __u32    ui_author;        /*  0x4 GNU HURD: author */
  452.     } ui_u1;
  453.     __u64    ui_size;        /*  0x8 */
  454.     struct ufs_timeval ui_atime;    /* 0x10 access */
  455.     struct ufs_timeval ui_mtime;    /* 0x18 modification */
  456.     struct ufs_timeval ui_ctime;    /* 0x20 creation */
  457.     union {
  458.         struct {
  459.             __u32    ui_db[UFS_NDADDR];/* 0x28 data blocks */
  460.             __u32    ui_ib[UFS_NINDIR];/* 0x58 indirect blocks */
  461.         } ui_addr;
  462.         __u8    ui_symlink[4*(UFS_NDADDR+UFS_NINDIR)];/* 0x28 fast symlink */
  463.     } ui_u2;
  464.     __u32    ui_flags;        /* 0x64 immutable, append-only... */
  465.     __u32    ui_blocks;        /* 0x68 blocks in use */
  466.     __u32    ui_gen;            /* 0x6c like ext2 i_version, for NFS support */
  467.     union {
  468.         struct {
  469.             __u32    ui_shadow;    /* 0x70 shadow inode with security data */
  470.             __u32    ui_uid;        /* 0x74 long EFT version of uid */
  471.             __u32    ui_gid;        /* 0x78 long EFT version of gid */
  472.             __u32    ui_oeftflag;    /* 0x7c reserved */
  473.         } ui_sun;
  474.         struct {
  475.             __u32    ui_uid;        /* 0x70 File owner */
  476.             __u32    ui_gid;        /* 0x74 File group */
  477.             __s32    ui_spare[2];    /* 0x78 reserved */
  478.         } ui_44;
  479.         struct {
  480.             __u32    ui_uid;        /* 0x70 */
  481.             __u32    ui_gid;        /* 0x74 */
  482.             __u16    ui_modeh;    /* 0x78 mode high bits */
  483.             __u16    ui_spare;    /* 0x7A unused */
  484.             __u32    ui_trans;    /* 0x7c filesystem translator */
  485.         } ui_hurd;
  486.     } ui_u3;
  487. };
  488.  
  489. /* FreeBSD has these in sys/stat.h */
  490. /* ui_flags that can be set by a file owner */
  491. #define UFS_UF_SETTABLE   0x0000ffff
  492. #define UFS_UF_NODUMP     0x00000001  /* do not dump */
  493. #define UFS_UF_IMMUTABLE  0x00000002  /* immutable (can't "change") */
  494. #define UFS_UF_APPEND     0x00000004  /* append-only */
  495. #define UFS_UF_OPAQUE     0x00000008  /* directory is opaque (unionfs) */
  496. #define UFS_UF_NOUNLINK   0x00000010  /* can't be removed or renamed */
  497. /* ui_flags that only root can set */
  498. #define UFS_SF_SETTABLE   0xffff0000
  499. #define UFS_SF_ARCHIVED   0x00010000  /* archived */
  500. #define UFS_SF_IMMUTABLE  0x00020000  /* immutable (can't "change") */
  501. #define UFS_SF_APPEND     0x00040000  /* append-only */
  502. #define UFS_SF_NOUNLINK   0x00100000  /* can't be removed or renamed */
  503.  
  504. #ifdef __KERNEL__
  505.  
  506. /* acl.c */
  507. extern int ufs_permission (struct inode *, int);
  508.  
  509. /* balloc.c */
  510. extern void ufs_free_fragments (struct inode *, unsigned, unsigned);
  511. extern void ufs_free_blocks (struct inode *, unsigned, unsigned);
  512. extern unsigned ufs_new_fragments (struct inode *, u32 *, unsigned, unsigned, unsigned, int *);
  513.  
  514. /* cylinder.c */
  515. extern struct ufs_cg_private_info * ufs_load_cylinder (struct super_block *, unsigned);
  516. extern void ufs_put_cylinder (struct super_block *, unsigned);
  517.  
  518. /* dir.c */
  519. extern struct inode_operations ufs_dir_inode_operations;
  520. extern struct file_operations ufs_dir_operations;
  521. extern int ufs_check_dir_entry (const char *, struct inode *, struct ufs_dir_entry *, struct buffer_head *, unsigned long);
  522.  
  523. /* file.c */
  524. extern struct inode_operations ufs_file_inode_operations;
  525. extern struct file_operations ufs_file_operations;
  526.  
  527. /* ialloc.c */
  528. extern void ufs_free_inode (struct inode *inode);
  529. extern struct inode * ufs_new_inode (const struct inode *, int, int *);
  530.  
  531. /* inode.c */
  532. extern int ufs_bmap (struct inode *, int);
  533. extern void ufs_read_inode (struct inode *);
  534. extern void ufs_put_inode (struct inode *);
  535. extern void ufs_write_inode (struct inode *);
  536. extern int ufs_sync_inode (struct inode *);
  537. extern void ufs_write_inode (struct inode *);
  538. extern void ufs_delete_inode (struct inode *);
  539. extern struct buffer_head * ufs_getfrag (struct inode *, unsigned, int, int *);
  540. extern struct buffer_head * ufs_bread (struct inode *, unsigned, int, int *);
  541.  
  542. /* namei.c */
  543. extern int ufs_lookup (struct inode *, struct dentry *);
  544. extern int ufs_mkdir(struct inode *, struct dentry *, int);
  545. extern int ufs_rmdir (struct inode *, struct dentry *);
  546. extern int ufs_unlink (struct inode *, struct dentry *);
  547. extern int ufs_create (struct inode *, struct dentry *, int);
  548. extern int ufs_rename (struct inode *, struct dentry *, struct inode *, struct dentry *);
  549. extern int ufs_mknod (struct inode *, struct dentry *, int, int);
  550. extern int ufs_symlink (struct inode *, struct dentry *, const char *);
  551. extern int ufs_link (struct dentry *, struct inode *, struct dentry *);
  552.         
  553. /* super.c */
  554. extern struct super_operations ufs_super_ops;
  555. extern struct file_system_type ufs_fs_type;
  556. extern void ufs_warning (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
  557. extern void ufs_error (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
  558. extern void ufs_panic (struct super_block *, const char *, const char *, ...) __attribute__ ((format (printf, 3, 4)));
  559. extern int init_ufs_fs(void);
  560. extern void ufs_write_super (struct super_block *);
  561.  
  562. /* symlink.c */
  563. extern struct inode_operations ufs_symlink_inode_operations;
  564.  
  565. /* truncate.c */
  566. extern void ufs_truncate (struct inode *);
  567.  
  568. #endif    /* __KERNEL__ */
  569.  
  570. #endif /* __LINUX_UFS_FS_H */
  571.